package me.xplabs.ui.baseui 
{
	import flash.display.BitmapData;
	import flash.utils.Dictionary;
	import me.xplabs.Globals;
	/**
	 * ...
	 * @author xiaohan
	 */
	public class UIManager 
	{
		private var _buttonLib:Dictionary;
		private var _panelLib:Dictionary;
		public function UIManager() 
		{
			_buttonLib = new Dictionary();
			_panelLib = new Dictionary();
		}
		public function button(title:String,ptype:int=0,textSize:int=0,textColor:int=0):Button
		{
			var p:Button = new Button();
			var upword:BitmapData;
			var hightword:BitmapData;
			var downword:BitmapData;
			upword = Globals.lib.getResObj(Globals.domain.button + ptype + "_1");
			hightword = Globals.lib.getResObj(Globals.domain.button + ptype + "_2");
			downword = Globals.lib.getResObj(Globals.domain.button + ptype + "_3");
			if (downword == null) downword = Globals.lib.getResObj(Globals.domain.button + ptype + "_2");
			p.show(title, upword, downword, hightword);
			return p;
		}
		public function panel(pw:int, ph:int,ptype:int):Panel
		{
			var p:Panel = new Panel();
			var data:BitmapData = Globals.lib.getResObj(Globals.domain.panel + ptype);
			switch(ptype)
			{
				case 1:
				case 2:
					p.show(data, 1, 1, 1, 1);
					break;
				case 3:
				case 4:
					p.show(data, 7, 7, 1, 1);
					break;
			}
			p.setWH(pw, ph);
			return p;
		}
		
		public function label(ptext:String, pw:int = 0, ph:int = 0):Label
		{
			var p:Label = new Label();
			p.show(ptext, pw, ph);
			return p;
		}
	}
}